{php include wl_template('common/header');}
<div class="app-content">
	<ul class="nav nav-tabs">
		<li {if $_GPC['postType']=='setting'}class="active"{/if} ><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'setting'))}">一卡通设置</a></li>
		{if $_W['wlsetting']['halfcard']['halfcardtype'] != 1}
		<li {if $_GPC['postType']=='type'}class="active"{/if} ><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'type'))}">一卡通类型</a></li>
		{/if}
		<li {if $_GPC['postType']=='list'}class="active"{/if} ><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'list'))}">激活码列表</a></li>
		<li {if $_GPC['postType']=='apply'}class="active"{/if} ><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'apply'))}">代理申请</a></li>
		<li {if $_GPC['postType']=='add'}class="active"{/if}><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'add'))}">增加激活码</a></li>
		{if $_GPC['postType']=='addType'}
		<li {if $_GPC['postType']=='addType'}class="active"{/if}><a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'addType'))}">增加类型</a></li>
		{/if}
	</ul>
	{if $_GPC['postType']=='setting'}
	<ul class="nav nav-tabs" id="myTab">
		<li class="active"><a href="#tab_basic">基本设置</a></li>
		<li><a href="#tab_share">列表分享</a></li>
		{if $_W['wlsetting']['halfcard']['halfcardtype'] != 1}
		<li><a href="#tab_QA">常见问题</a></li>
		{/if}
		{if $distri['switch']}<li><a href="#tab_distri">分销设置</a></li>{/if}
	</ul>
	<div class="app-form">
		<div class="main">
			<form action="" method="post" class="form-horizontal" id="setting-form">
				<div class="panel panel-default">
					<div class="panel-heading">模块设置</div>
					<div class="panel-body">
						<div class="tab-content">
							<div class="tab-pane active" id="tab_basic">
								<div class="form-group">
									<label class="col-sm-2 control-label">是否开启一卡通</label>
									<div class="col-xs-12 col-sm-8">
										<div class="radio radio-success radio-inline" >
											<input type="radio" id="inlineRadio1" name="base[status]" value="1" {if intval($base['status']) == 1}checked{/if}>
											<label for="inlineRadio1">开启 </label>
										</div>
										<div class="radio radio-success radio-inline" >
											<input type="radio" id="inlineRadio2" name="base[status]" value="0" {if intval($base['status']) == 0 || empty($base['status'])}checked{/if}>
											<label for="inlineRadio2">关闭 </label>
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">是否开启平时折扣</label>
									<div class="col-xs-12 col-sm-8">
										<div class="radio radio-success radio-inline" onclick="showdaily(1)" >
											<input type="radio" id="inlineRadio11" name="base[daily]" value="1" {if intval($base['daily']) == 1}checked{/if}>
											<label for="inlineRadio11">开启 </label>
										</div>
										<div class="radio radio-success radio-inline" onclick="showdaily(0)">
											<input type="radio" id="inlineRadio12" name="base[daily]" value="0" {if intval($base['daily']) == 0 || empty($base['daily'])}checked{/if}>
											<label for="inlineRadio12">关闭 </label>
										</div>
									</div>
								</div>
								<div class="form-group" id="showdaily" {if intval($base['daily']) == 0 || empty($base['daily'])} style="display: none;" {/if}>
								<label class="col-sm-2 control-label">特权页面显示平时折扣</label>
								<div class="col-xs-12 col-sm-8">
									<div class="radio radio-success radio-inline" >
										<input type="radio" id="inlineRadio13" name="base[dailyshow]" value="1" {if intval($base['dailyshow']) == 1}checked{/if}>
										<label for="inlineRadio13">开启 </label>
									</div>
									<div class="radio radio-success radio-inline" >
										<input type="radio" id="inlineRadio14" name="base[dailyshow]" value="0" {if intval($base['dailyshow']) == 0 || empty($base['dailyshow'])}checked{/if}>
										<label for="inlineRadio14">关闭 </label>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">一卡通每天使用次数</label>
								<div class="col-xs-12 col-sm-9">
									<div class="input-group">
										<input type="text" name="base[daytimes]" class="form-control" value="{$base['daytimes']}" />
										<span class="input-group-addon">次/天</span>
									</div>
									<span class="help-block">特权特权每天使用次数，不填则无限制</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">文字</label>
								<div class="col-sm-8 col-xs-12">
									<div class="input-group">
										<span class="input-group-addon">一卡通=</span>
										<input type="text" name="base[halfcardtext]" class="form-control" value="{$base['halfcardtext']}">
										<span class="input-group-addon">特权=</span>
										<input type="text" name="base[halftext]" class="form-control" value="{$base['halftext']}">
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">一卡通背景</label>
								<div class="col-sm-8">
									{php echo attachment_select('base[halfcard_image]', $base['halfcard_image']);}
									<span class="help-block">不上传为默认图片，图片尺寸750X205</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">介绍头部图</label>
								<div class="col-sm-8">
									{php echo attachment_select('base[halfcard_header]', $base['halfcard_header']);}
									<span class="help-block">不上传为默认图片，图片尺寸750X375</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">介绍图</label>
								<div class="col-sm-8">
									{php echo attachment_select('base[halfcard_introduce]', $base['halfcard_introduce']);}
									<span class="help-block">不上传为默认图片，图片尺寸750X1631</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">详情流程图</label>
								<div class="col-sm-8">
									{php echo attachment_select('base[halfcard_flow]', $base['halfcard_flow']);}
									<span class="help-block">不上传为默认图片，图片尺寸750X143</span>
								</div>
							</div>
						</div>
						<div class="tab-pane" id="tab_share">
							<div class="form-group">
								<label class="col-sm-2 control-label">分享标题</label>
								<div class="col-sm-8">
									<input type="text" name="base[share_title]" class="form-control" value="{$base['share_title']}" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">分享图片</label>
								<div class="col-sm-8">
									{php echo attachment_select('base[share_image]', $base['share_image']);}
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">分享描述</label>
								<div class="col-sm-8">
									<input type="text" name="base[share_desc]" class="form-control" value="{$base['share_desc']}" />
								</div>
							</div>
						</div>
						{if $_W['wlsetting']['halfcard']['halfcardtype'] != 1}
						<div class="tab-pane" id="tab_QA">
							<label class="col-sm-2 control-label">常见问题设置</label>
							<div class="col-md-12">
								<div id="datas" class="sms-template-1" style="display:block;">
									{if !empty($base['qa'])}
									{loop $base['qa'] $data}
									{php include wl_template('halfcard/QandA');}
									{/loop}
									{/if}
								</div>
								<div class="form-group sms-template-1" style="display:block;">
									<label class="col-sm-2 control-label"></label>
									<div class="col-sm-8 col-xs-12">
										<a class="btn btn-default btn-add-type" href="javascript:;" onclick="addType();">
											<i class="fa fa-plus" title=""></i>增加一条常见问题</a>
									</div>
								</div>
							</div>
						</div>
						{/if}
						<div class="tab-pane" id="tab_distri">
							<div class="form-group">
								<label class="col-sm-2 control-label">一级佣金比例</label>
								<div class="col-xs-12 col-sm-9">
									<div class="input-group">
										<input type="text" name="base[onecommission]" class="form-control" value="{$base['onecommission']}" />
										<span class="input-group-addon">%</span>
									</div>
									<span class="help-block">买家上级所获佣金</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">二级佣金比例</label>
								<div class="col-xs-12 col-sm-9">
									<div class="input-group">
										<input type="text" name="base[twocommission]" class="form-control" value="{$base['twocommission']}" />
										<span class="input-group-addon">%</span>
									</div>
									<span class="help-block">买家上级的上级所获佣金</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">三级佣金比例</label>
								<div class="col-xs-12 col-sm-9">
									<div class="input-group">
										<input type="text" name="base[threecommission]" class="form-control" value="{$base['threecommission']}" />
										<span class="input-group-addon">%</span>
									</div>
									<span class="help-block">买家最高上级所获佣金</span>
								</div>
							</div>
						</div>
					</div>
				</div>
		</div>
			<div class="form-group col-sm-12">
				<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
				<input type="hidden" name="token" value="{$_W['token']}" />
			</div>
			</form>
		</div>
	</div>
	{/if}
	{if $_GPC['postType']=='type'}
		<div class="page-heading">
			<span class="pull-right" style="    margin-top: -10px;">
						<a class="btn btn-primary btn-sm" href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'addType'));}"><i class="fa fa-add"></i> 增加</a>
					</span>
			<h4>类型列表</h4>
		</div>
		<div class="app-table-list">
			<div class="panel panel-default">
				<div class="table-responsive">
					<table class="table table-hover table-bordered">
						<thead>
						<tr>
							<th  class="text-center" style="width:90px;">LOGO</th>
							<th class="text-center" style="width:120px;">类型名称</th>
							<th class="text-center" style="width:60px;">时长</th>
							<th class="text-center" style="width:100px;">价格</th>
							<th class="text-center" style="width:100px;">显示</th>
							<th class="text-center" style="width:100px;">操作</th>
						</tr>
						</thead>
						<tbody>
						{loop $list $item}
						<tr class="text-center" >
							<td>
								<div class="img">
									<img width="50" height="50" class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{php echo tomedia($item['logo'])}" height="50" width="50" onerror="this.src='{IMAGE_NOPIC_SMALL}'" >
								</div>
							</td>
							<td>
								{$item['name']}
							</td>
							<td>
								{$item['days']}天
							</td>
							<td>{$item['price']}</td>
							<td>{if $item['status']==1}<label class="btn btn-primary">显示</label>{else}<label class="btn btn-default">隐藏</label>{/if}</td>
							<td style="position:relative;">
								{if $_W['wlsetting']['halfcard']['halfcardtype'] != 1}
								<a href="{php echo web_url('halfcard/halfcard_web/base',array('id'=>$item['id'],'postType'=>'addType'))}">编辑  </a>
								- <a href="{php echo web_url('halfcard/halfcard_web/base',array('id'=>$item['id'],'postType'=>'delType'))}">删除  </a>
								{/if}
							</td>
						</tr>
						{/loop}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	{$pager}
	{/if}
	{if $_GPC['postType']=='addType'}
		<div class="app-form">
			<div class="main">
				<form action="" method="post" class="form-horizontal form" id="form">
					<div class="panel panel-default">
						<div class="panel-heading">一卡通类别</div>
						<div class="panel-body">
							<div class="panel-body">
								<div class="form-group">
									<label class="col-sm-2 control-label">LOGO</label>
									<div class="col-sm-9">
										{php echo attachment_select('data[logo]', $data['logo']);}
										<span class="help-block">图片建议为640X300</span>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">类别名称</label>
									<div class="col-sm-9">
										<input type="text" name="data[name]" id="name" class="form-control" value="{$data['name']}" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">时长</label>
									<div class="col-md-4">
										<div class="input-group">
											<span class="input-group-addon">天</span>
											<input type="text" name="data[days]" class="form-control" value="{$data['days']}" />
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label" >价格</label>
									<div class="col-md-4">
										<div class="input-group">
											<span class="input-group-addon">￥</span>
											<input type="text" name="data[price]" class="form-control" value="{$data['price']}" />
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label" >可开通次数</label>
									<div class="col-md-4">
										<div class="input-group">
											<input type="text" name="data[num]" class="form-control" value="{$data['num']}" />
											<span class="help-block">不填或则填0表示不限制</span>
										</div>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">是否显示</label>
									<div class="col-xs-12 col-sm-8">
										<div class="radio radio-success radio-inline">
											<input type="radio" id="inlineRadio1" name="data[status]" value="1" {if intval($data['status']) == 1}checked="checked"{/if}>
											<label for="inlineRadio1"> 显示 </label>
										</div>
										<div class="radio radio-success radio-inline">
											<input type="radio" id="inlineRadio2" name="data[status]" value="2" {if intval($data['status']) != 1}checked="checked"{/if} >
											<label for="inlineRadio2"> 隐藏 </label>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="form-group col-sm-12">
						<input type="hidden" name="id" value="{$data['id']}" />
						<input type="hidden" name="postType" value="{$_GPC['postType']}" />
						<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
						<input type="hidden" name="token" value="{$_W['token']}" />
					</div>
					</from>
			</div>
		</div>
	{/if}
	{if $_GPC['postType']=='list'}
	<div class="app-form">
		<div class="panel">
			<div class="panel-body">
				<form action="" method="get" class="form-horizontal" role="form" id="form1">
					<input type="hidden" name="c" value="site" />
					<input type="hidden" name="a" value="entry" />
					<input type="hidden" name="m" value="weliam_smartcity" />
					<input type="hidden" name="p" value="halfcard" />
					<input type="hidden" name="ac" value="halfcard_web" />
					<input type="hidden" name="do" value="base"/>
					<input type="hidden" name="postType" value="list"/>
					<div class="form-group">
						<div class="col-md-2">
							<select name="vipType" class="form-control">
								<option value="">一卡通类型</option>
								{loop $types $row}
								<option {if $_GPC['vipType']==$row['id']}selected="selected"{/if} value="{$row['id']}">{$row['name']}</option>
								{/loop}
							</select>
						</div>
						<div class="col-md-2">
							<select name="status" class="form-control">
								<option value="">状态</option>
								<option value="1" {if $_GPC['status']==1}selected="selected"{/if}>使用中</option>
								<option value="2" {if $_GPC['status']==2}selected="selected"{/if}>空闲</option>
							</select>
						</div>
						<div class="col-md-2">
							<select   name="keywordtype" class="form-control">
								<option value="">关键字类型</option>
								<option value="1" {if $_GPC['keywordtype']==1}selected="selected"{/if}>时长</option>
								<option value="2" {if $_GPC['keywordtype']==2}selected="selected"{/if}>激活人昵称</option>
								<option value="3" {if $_GPC['keywordtype']==3}selected="selected"{/if}>备注</option>
							</select>
						</div>
						<div class="col-sm-9">
							<div class="input-group">
								<input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
								<span class="input-group-addon" id="search">搜索</span><span class="input-group-addon" id="output">导出</span>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		$("#search").click(function(){
			$('#form1')[0].submit();
		})
		$('#output').click(function(){
			var vipType = "{$_GPC['vipType']}";
			var status = "{$_GPC['status']}";
			var keywordtype = "{$_GPC['keywordtype']}";
			var keyword = "{$_GPC['keyword']}";
			location.href = "{php echo web_url('halfcard/halfcard_web/base')}&postType=output&vipType="+vipType+"&status="+status+"&keywordtype="+keywordtype+"&keyword="+keyword;
		});
	</script>
	<script type="text/javascript">
		$("#search").click(function(){
			$('#form1')[0].submit();
		})
		$('#output').click(function(){
			var vipType = "{$_GPC['vipType']}";
			var status = "{$_GPC['status']}";
			var keywordtype = "{$_GPC['keywordtype']}";
			var keyword = "{$_GPC['keyword']}";
			location.href = "{php echo web_url('halfcard/halfcard_web/base')}&postType=output&vipType="+vipType+"&status="+status+"&keywordtype="+keywordtype+"&keyword="+keyword;
		});
	</script>
	<div class="app-table-list">
		<div class="panel panel-default">
			<div class="table-responsive">
				<table class="table table-hover table-bordered">
					<thead>
					<tr>
						<th style="width:40px;" class="text-center"><input type="checkbox" onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" /></th>
						<th class="text-center" style="width:90px;">一卡通类型</th>
						<th class="text-center" style="width:110px;">使用详情</th>
						<th class="text-center" style="width:70px;">激活码</th>
						<th class="text-center" style="width:60px;">时长</th>
						<th class="text-center" style="width:60px;">状态</th>
						<th class="text-center" style="width:100px;">备注</th>
						<th class="text-center" style="width:140px;">生成时间</th>
						<th class="text-center" style="width:100px;">操作</th>
					</tr>
					</thead>
					<tbody>
					{loop $list $item}
					<tr class="text-center" >
						<td class="text-center" style="width:40px; height: auto;">
							<center><input type="checkbox" name="checkbox[]" class="checkbox" value="{$item['id']}" /></center>
						</td>
						<td>
						<span class="label label-info">
						{$item['typename']}
						</span>
						</td>
						<td>
							{if !empty($item['member'])}
							<div class="img" style="text-align: left;">
								<img width="35" height="35" class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{php echo tomedia($item['member']['avatar'])}">
								<span>{$item['member']['nickname']}</span>
							</div>
							{/if}
						</td>
						<td>{$item['number']}</td>
						<td>
							{$item['days']}天
						</td>
						<td>
							{if $item['status']==1}
							<span id="" class="label label-success">
						使用中
						</span>
							{else}
							<span id="" class="label label-default">
						空闲
						</span>
							{/if}
						</td>
						<td>
							<input style="width: 100%;" type="text" name="remark" id="{$item['id']}" class="form-control" value="{$item['remark']}" />
						</td>
						<td>
							{php echo date('Y-m-d H:i:s',$item['createtime'])}
						</td>
						<td>
							<button type="button" class="btn btn-primary" title="提交备注" onclick="set_remark('{$item['id']}');"><i class="fa fa-check"></i></button>
							<a href="{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'del','id'=>$item['id']))}" title="删除"  class="btn btn-danger"><i class="fa fa-trash-o"></i></a>
						</td>
					</tr>
					{/loop}
					</tbody>
				</table>
			</div>
		</div>
	</div>
	{$pager}
	<div id="de1" style="margin-top: 15px;">
	<a href="javascript:;" class="btn btn-default min-width js-batch js-delete">删除选中记录</a>
</div>
	<script type="text/javascript">
		function set_remark(id){
			var remark = $('#'+id).val();
			$.post("{php echo web_url('halfcard/halfcard_web/base',array('postType'=>'remark'))}"
				,{id:id,remark:remark}
				,function(d){
					layer.alert(d.message);
				}
				,"json"
			);
		}
		//删除用户记录
		$('#de1').delegate('.js-delete','click',function(e){
			e.stopPropagation();
			var order_ids = [];
			var $checks=$('.checkbox:checkbox:checked');
			$checks.each(function() {
				if (this.checked) {
					order_ids.push(this.value);
				};
			});
			var $this = $(this);
			var ids = order_ids;
			//alert(ids);

			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('halfcard/halfcard_web/deletejihuoqr')}", { ids : ids }, function(data){
					if(!data.errno){
						util.tips("删除成功！");
						location.reload();
					};
				}, 'json');
			}, {html: '确认删除?'});
		});
	</script>
	{/if}
	{if $_GPC['postType']=='apply'}
	<div class="app-table-list">
		<div class="panel panel-default">
			<div class="table-responsive">
				<table class="table table-hover table-bordered">
					<thead>
					<tr>
						<th class="text-center" style="width:120px;">vip类型</th>
						<th class="text-center" style="width:60px;">时长</th>
						<th class="text-center" style="width:60px;">申请数量</th>
						<th class="text-center" style="width:60px;">申请状态</th>
						<th class="text-center" style="width:120px;">申请时间</th>
						<th class="text-center" style="width:120px;">操作</th>
					</tr>
					</thead>
					<tbody>
					{loop $applys $item}
					<tr class="text-center" >
						<td>
						<span class="label label-info">
						{$item['token']['name']}
						</span>
							{if !empty($item['aid'])}
							&nbsp;
							<span class="label label-primary">
						 {$item['aName']}
						</span>
							{else}
							<span class="label label-danger">
						系统
						</span>
							{/if}
						</td>
						<td>
							{$item['token']['days']}天
						</td>
						<td>{$item['num']}</td>
						<td>
							{if $item['status']==1}
							<span id="" class="label label-success">
						申请中
						</span>
							{else}
							<span id="" class="label label-default">
						已生成
						</span>
							{/if}
						</td>
						<td>{php echo date('Y-m-d H:i:s',$item['createtime'])}</td>
						<td>
							{if $item['status']==1}
							<a href="#" title="已生成"  class="btn btn-warning">申请中</a>
							{else}
							<a href="#" title="已生成"  class="btn btn-primary">完成</a>
							{/if}
							- <a href="javascript:;" title="删除" id="{$item['id']}" class="btn btn-danger remove">删除</a>
						</td>
					</tr>
					{/loop}
					</tbody>
				</table>
			</div>
		</div>
	</div>
	<script>
		$('.remove').click(function(e){
			e.stopPropagation();
			var $this = $(this);
			var id = $this.attr('id');
			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('halfcard/halfcard_web/base')}&postType=delete", { id : id }, function(data){
					if(!data.errno){
						$this.parent().parent().remove();
						util.tips("删除成功！");
					};
				}, 'json');
			}, {html: '确认删除?'});
		});
	</script>
	{$pager}
	{/if}
	{if $_GPC['postType']=='add'}
	<div class="app-form">
		<div class="main">
			<form action="" method="post" class="form-horizontal form" id="form">
				<div class="tab-content">
					<div class="panel panel-default">
						<div class="panel-heading">基本信息</div>
						<div class="panel-body">
							<div class="panel-body">
								{if $apply}
								<table class="table table-hover table-bordered">
									<thead>
									<tr>
										<th class="text-center" style="width:120px;">一卡通类型</th>
										<th class="text-center" style="width:60px;">时长</th>
										<th class="text-center" style="width:60px;">申请数量</th>
										<th class="text-center" style="width:60px;">申请状态</th>
										<th class="text-center" style="width:120px;">申请时间</th>
									</tr>
									</thead>
									<tbody>
									<tr class="text-center" >
										<td>
										<span class="label label-danger">
										{$apply['token']['name']}
										</span>
										</td>
										<td>
											{$apply['token']['days']}天
										</td>
										<td>{$apply['num']}</td>
										<td>
											{if $apply['status']==1}
											<span id="" class="label label-success">
										申请中
										</span>
											{else}
											<span id="" class="label label-default">
										已生成
										</span>
											{/if}
										</td>
										<td>{php echo date('Y-m-d H:i:s',$apply['createtime'])}</td>
									</tr>
									</tbody>
								</table>
								<input type="hidden" name="secretkey_type" id="secretkey_type" value="{$apply['token']['id']}" />
								<input type="hidden" name="applyid" id="applyid" value="{$apply['id']}" />
								{else}
								<div class="form-group">
									<label class="col-sm-2 control-label"><span style='color:red'>*</span>可生成一卡通激活码</label>
									<div class="col-sm-9">
										{loop $types $row}
										{if empty($allow)}
										{else}
										{if in_array($row['id'],$settings['halfcardtypeids'])}
										<div class="checkbox checkbox-success checkbox-inline">
											<input type="checkbox" id="{$row['id']}"  name="type[]" value="{$row['id']}" checked="checked" disabled="true">
											<label for="{$row['id']}"> {$row['name']} </label>
										</div>
										{/if}
										{/if}
										{/loop}
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label"><span style='color:red'>*</span>可申请一卡通激活码</label>
									<div class="col-sm-9">
										{loop $types $row}
										{if empty($allow)}
										<div class="checkbox checkbox-success checkbox-inline">
											<input type="checkbox" id="{$row['id']}"  name="type[]" value="{$row['id']}" checked="checked" disabled="true">
											<label for="{$row['id']}"> {$row['name']} </label>
										</div>
										{else}
										{if !in_array($row['id'],$settings['halfcardtypeids'])}
										<div class="checkbox checkbox-success checkbox-inline">
											<input type="checkbox" id="{$row['id']}"  name="type[]" value="{$row['id']}" checked="checked" disabled="true">
											<label for="{$row['id']}"> {$row['name']} </label>
										</div>
										{/if}
										{/if}
										{/loop}
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label"><span style='color:red'>*</span>激活码类型</label>
									<div class="col-sm-9">
										<select name="secretkey_type" class="form-control">
											{loop $types $row}
											<option value="{$row['id']}">{$row['name']}</option>
											{/loop}
										</select>
									</div>
								</div>
								{/if}
								<div class="form-group">
									<label class="col-sm-2 control-label">创建个数</label>
									<div class="col-sm-9">
										<input type="text" name="num" class="form-control" placeholder="创建个数" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">激活码备注</label>
									<div class="col-sm-9">
										<input type="text" name="remark" class="form-control" placeholder="请输入激活码备注" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="form-group col-sm-12">
					<input type="submit" name="submit" value="确定" class="btn btn-primary col-lg-1" />
					<input type="hidden" name="token" value="{$_W['token']}" />
					<input type="hidden" name="postType" value="{$_GPC['postType']}" />
				</div>
				</from>
		</div>
	</div>
	{/if}
</div>
<script>
	$(function() {
		window.optionchanged = false;
		$('#myTab a').click(function(e) {
			e.preventDefault(); //阻止a链接的跳转行为
			$(this).tab('show'); //显示当前选中的链接及关联的content
		})
	}); 
	var kw = 1;var kw2 = 1;
	function addType() {
	    $(".btn-add-type").button("loading");
	    $.ajax({
	        url: "{php echo web_url('halfcard/halfcard_web/QandA')}&kw="+kw,
	        cache: false
	    }).done(function (html) {
	        $(".btn-add-type").button("reset");
	        $("#datas").append(html);
	    });
	    kw++;
	}
	function addType2() {
	    $(".btn-add-type2").button("loading");
	    $.ajax({
	        url: "{php echo web_url('halfcard/halfcard_web/halfcardprice')}&kw="+kw2,
	        cache: false
	    }).done(function (html) {
	        $(".btn-add-type2").button("reset");
	        $("#datas2").append(html);
	    });
	    kw2++;
	}
	function showdaily(flag){
		if(flag){
			$('#showdaily').show();
		}else{
			$('#showdaily').hide();
		}
	}
</script>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
	function set_remark(id){
		var remark = $('#'+id).val();
		$.post("{php echo web_url('secretkey/secretkey/remark')}"
			,{id:id,remark:remark}
			,function(d){
				layer.alert(d.message);
			}
			,"json"
		);
	}
</script>
{php include wl_template('common/footer');}